package com.acme;


public class Arrays {
	public static void main(String[] args) {
		int [] array;
		int i;
		//TODO: define array consisting on 5 elements
		array = new int[5];
		for (i = 0; i < 5; i++)
			array[i] = i;
		System.out.println(array.length);
		try {
			System.out.println(array[5]);//ArrayIndexOutOfBoundsException, we defined array with length 5, but trying to get 6th element of this array, of course we cant do it
		}catch (ArrayIndexOutOfBoundsException e){ //We catched exception, now print our message
			System.out.println("Invalid array index. The length of array is: " + array.length);
		}
		
	}
}
